<!DOCTYPE html>
<html lang=''>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='./vue.js'></script>
</head>

<body>
    <div id='app'>
        <button>军平的按钮</button>

        <!-- 2. 使用组件  -->
        <my-button></my-button>
        <my-button></my-button>
        <my-button></my-button>
        <my-button></my-button>
    </div>
</body>
<script>
    const app = Vue.createApp({
        data () {
            return {}
        },
    })

    // 直接注册组件
    // 1. 注册一个全局组件
    // 参数1：组件的名称
    // 参数2：组件的描述
    app.component('my-button', {
        template: `<button @click='count++'>按钮 {{count}}</button>`,
        data () {
            return {
                count: 0
            }
        },
    })

    app.mount('#app')
</script>

</html>